package com.usian.controller;

import com.usian.enlist.Enlist;
import com.usian.service.EnlistService;
import com.usian.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/app/enlist")
public class EnlistController {

    @Autowired
    private EnlistService enlistService;

    @RequestMapping("/findAll")
    public Result findAll(){
        List<Enlist> enlist = enlistService.findAll();
        return Result.success(enlist);
    }
    @RequestMapping("/add")
    public Result add(@RequestBody Enlist enlist){
        enlistService.add(enlist);
        return Result.success();
    }
}
